import Vue from 'vue'
import VueRouter from 'vue-router'
import RenderRouterView from '@/components/RenderRouterView'
import Home from '@/views/Home'

Vue.use(VueRouter)

const routes = [

  {
    path: "/",
    redirect:"/user/login"
  },
  {
    path: "/home",
    redirect:"/dashboard/workbench"
  },
  {
    path: "/dashboard",
    redirect: "/dashboard/workbench",
    component:Home,
    children:[
      {
        path:'/dashboard/statistics',
        name:'statistics',
        component: () => import(/* webpackChunkName: "user" */ '../views/dashboard/Statistics.vue')
      },
      {
        path:'/dashboard/workbench',
        name:'workbench',
        component: () => import(/* webpackChunkName: "user" */ '../views/dashboard/Workbench.vue')
      }
    ]
  },
  {
    path: "/userM",
    component:Home,
    children:[
      {
        path:'/userM/student',
        name:'student',
        component: () => import(/* webpackChunkName: "user" */ '../views/user/Student.vue')
      },
      {
        path:'/userM/subway',
        name:'subway',
        component: () => import(/* webpackChunkName: "user" */ '../views/user/Subway.vue')
      },
      {
        path:'/userM/admin',
        name:'admin',
        component: () => import(/* webpackChunkName: "user" */ '../views/user/Admin.vue')
      }
    ]
  },
  {
    path: "/authority",
    component:Home,
    children:[
      {
        path:'/authority/role',
        name:'role',
        component: () => import(/* webpackChunkName: "user" */ '../views/authority/Role.vue')
      },
      {
        path:'/authority/role_api',
        name:'role_api',
        component: () => import(/* webpackChunkName: "user" */ '../views/authority/RoleAPI.vue')
      },
      {
        path:'/authority/role_menu',
        name:'role_menu',
        component: () => import(/* webpackChunkName: "user" */ '../views/authority/RoleMenu.vue')
      },
      {
        path:'/authority/role_admin',
        name:'role_admin',
        component: () => import(/* webpackChunkName: "user" */ '../views/authority/RoleAdmin.vue')
      },
      {
        path:'/authority/api',
        name:'api',
        component: () => import(/* webpackChunkName: "user" */ '../views/authority/API.vue')
      }
    ]
  },
  {
    path: "/repair",
    component:Home,
    children:[
      {
        path:'/repair/recode',
        name:'recode',
        component: () => import(/* webpackChunkName: "user" */ '../views/repair/Recode.vue')
      }
    ]
  },

  {
    path: "/user",
    component:RenderRouterView,
    children:[
      {
        path:'/user/login',
        name:'login',
        component: () => import(/* webpackChunkName: "user" */ '../views/user/Login.vue')
      }
    ]
  },


  {
    path: '/home',
    name: 'home',
    component: () => import(/* webpackChunkName: "about" */ '../views/Home.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
